package code.c04_String.ch01_SqString;

import com.sun.org.apache.bcel.internal.generic.SIPUSH;

/**
 * @author thinkpad - 83start
 * @version v1.0
 * @create 2022/10/8 20:42
 * @package code.c04_String.ch01_String
 * @description 文件说明
 */

public class SqStringClass {
    final int MAX_SIZE = 100;
    char[] data;
    int size;

    public SqStringClass() {
        data = new char[MAX_SIZE];
        size = 0;
    }

    // ====================== 串的基本运算 =======================
    public SqStringClass subStr(int i, int j) {
        SqStringClass s = new SqStringClass();
        if (i < 0 || i >= size || j < 0 || i + j > size) {
            return s;
        }
        for (int k = 1; k < i + j; k++) {
            s.data[k -i] =data[k];
        }

        s.size = j;
        return s;
    }
}
